<?php

/*

*/

$page_title = "Move";
$rank_check = 1;
include "global.inc.php";

$location = $getInfo[location];
if (!$location) { $location = "World"; }

$findLocation = fetch("SELECT * FROM locations WHERE location_name = '$getInfo[location]'");

if ($dir == "in")
{
	$findLocation2 = fetch("SELECT * FROM locations WHERE location_name = '$move_to'");
	if ($findLocation2[go_back] != "$location")
	{
		die(header(error("explore.php?game=$game","You can't get there from here!")));
	}
	mysql_query("UPDATE members2 SET location = '$findLocation2[location_name]' WHERE id = '$userid' AND game = '$game'");
}

if ($dir == "back")
{
	$findLocation2 = fetch("SELECT * FROM locations WHERE location_name = '$findLocation[go_back]'");
	if ($back == "2")
	{
		$findLocation2 = fetch("SELECT * FROM locations WHERE location_name = '$findLocation[go_back2]'");
		$findLocation[go_back] = $findLocation2[location_name];
	}
	if (!$findLocation2[id])
	{
		die(header(error("explore.php?game=$game","You cannot go back any further right now!")));
	}

	mysql_query("UPDATE members2 SET location = '$findLocation[go_back]' WHERE id = '$userid' AND game = '$game'");
}

header("Location: explore.php?game=$game&error=$error");

?>
